<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var day = 15;
        if (day === 1) {
            console.log("今天是星期一");

        } else if (day === 2) {
            console.log("今天是星期二");

        } else if (day === 3) {
            console.log("今天是星期三");

        } else if (day === 4) {
            console.log("今天是星期四");

        }
        else if (day === 5) {
            console.log("今天是星期五");

        }
        else if (day === 6) {
            console.log("今天是星期六");

        }
        else {
            console.log("今天是星期日");

        }
        // if...else嵌套 if...else的匹配规则：if总是找离他最近的else
        var eat = true
        var food = "鸡蛋"
        if (eat) {
            if (food === "鸡蛋"){
                console.log("今天吃的鸡蛋");
            }else{
            console.log("今天吃的苹果");}
        }
        else {
            console.log("今天不吃饭");

        }
    </script>
</body>

</html>